<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt" %>
<%@ page contentType="text/html; charset=utf-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>平台管理系统</title>
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, minimum-scale=1.0, maximum-scale=1.0, user-scalable=0">
    <link rel="stylesheet" href="/layuiadmin/layui/css/layui.css" media="all">
    <link rel="stylesheet" href="/layuiadmin/style/admin.css" media="all">
    <link rel="stylesheet" type="text/css" href="/css/plugins/dropzone/basic.css"/>
    <link rel="stylesheet" type="text/css" href="/css/plugins/dropzone/dropzone.css"/>
    <link rel="stylesheet" type="text/css" href="/css/plugins/layui-formSelect/formSelects-v4.css"/>
    <link rel="stylesheet" type="text/css" href="/css/plat-style.css"/>
    <style>
        img{margin-left: 5px}
    </style>
</head>
<body>
<div class="layui-col-md12">
    <div class="layui-card">
        <div class="layui-card-body">
            <div class="layui-tab layui-tab-brief" lay-filter="test">
                <ul class="layui-tab-title">
                    <li class="layui-this" lay-id="1">&nbsp;&nbsp;&nbsp;用户提现设置&nbsp;&nbsp;&nbsp;</li>
                    <li lay-id="2">&nbsp;&nbsp;&nbsp;商家提现设置&nbsp;&nbsp;&nbsp;</li>
                    <li lay-id="4">&nbsp;&nbsp;&nbsp;代理提现设置&nbsp;&nbsp;&nbsp;</li>
                </ul>
                <div class="layui-tab-content">
                    <!-- 用户提现规则设置 -->
                    <div class="layui-tab-item layui-show" style="margin-top: 20px">
                        <form class="layui-form" id="editCusCashSetForm">
                            <input type="hidden" name="id" value="${customerRule.id}">
                            <div class="layui-container">
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>提现次数</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="num" value="${customerRule.num}" class="layui-input">
                                        <span class="green">表示用户限制提现次数(注：根据提现限制的类型 例如每天可以提现几次)</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>提现手续费</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="scale" value="${customerRule.scale}" class="layui-input">
                                        <span class="green">提现手续费比例,最低设置到万分比如0.0001(注：微信用户提现到零钱，微信针对平台的比例是0.006)</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>最低额</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="minVal" value="${customerRule.minVal}" class="layui-input">
                                        <span class="green">单笔提现最低金额</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>最高额</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="maxVal" value="${customerRule.maxVal}" class="layui-input">
                                        <span class="green">单笔提现最高金额(注：微信用户提现到零钱单笔是2000元)</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>提现金额的整数倍</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="multiple" value="${customerRule.multiple}" class="layui-input">
                                        <span class="green">提现金额的整倍数(注：微信用户提现到零钱单笔是2000元)</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>是否开启提现</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="radio" name="isOpen" value="1" title="开启" ${customerRule.isOpen==1?'checked':''}>
                                        <input type="radio" name="isOpen" value="0" title="关闭" ${customerRule.isOpen==0?'checked':''}>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>提现限制</label>
                                    <div class="layui-col-sm7" style="margin-left: 20px">
                                        <input type="radio" name="type" value="0" title="不限制" ${customerRule.type==0?'checked':''}>
                                        <input type="radio" name="type" value="1" title="限制每日提现次数" ${customerRule.type==1?'checked':''}>
                                        <input type="radio" name="type" value="2" title="限制每周提现次数" ${customerRule.type==2?'checked':''}>
                                        <input type="radio" name="type" value="3" title="限制每月提现次数" ${customerRule.type==3?'checked':''}>
                                    </div>
                                </div>
                                <div class="layui-card-body" style="padding: 15px;"></div>
                                <div class="layui-form-item">
                                    <div class="layui-col-sm4 layui-col-sm-offset5">
                                        <div class="layui-footer" style="left: 0;">
                                            <button class="layui-btn" type="button" onclick="saveCashSet('editCusCashSetForm')">保存</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-card-body" style="padding: 15px;"></div>
                            <input type="hidden" name="tabIndex" value="1">
                        </form>
                    </div>

                    <!-- 商家提现规则设置 -->
                    <div class="layui-tab-item" style="margin-top: 20px">
                        <form class="layui-form" id="editBusCashSetForm">
                            <input type="hidden" name="id" value="${businessRule.id}">
                            <div class="layui-container">
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>提现次数</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="num" value="${businessRule.num}" class="layui-input">
                                        <span class="green">表示用户限制提现次数(注：根据提现限制的类型 例如每天可以提现几次)</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>提现手续费</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="scale" value="${businessRule.scale}" class="layui-input">
                                        <span class="green">提现手续费比例,最低设置到万分比如0.0001(注：微信用户提现到零钱，微信针对平台的比例是0.006)</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>最低额</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="minVal" value="${businessRule.minVal}" class="layui-input">
                                        <span class="green">单笔提现最低金额</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>最高额</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="maxVal" value="${businessRule.maxVal}" class="layui-input">
                                        <span class="green">单笔提现最高金额(注：微信用户提现到零钱单笔是2000元)</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>提现金额的整数倍</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="multiple" value="${businessRule.multiple}" class="layui-input">
                                        <span class="green">提现金额的整倍数(注：微信用户提现到零钱单笔是2000元)</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>是否开启提现</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="radio" name="isOpen" value="1" title="开启" ${businessRule.isOpen==1?'checked':''}>
                                        <input type="radio" name="isOpen" value="0" title="关闭" ${businessRule.isOpen==0?'checked':''}>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>提现限制</label>
                                    <div class="layui-col-sm7" style="margin-left: 20px">
                                        <input type="radio" name="type" value="0" title="不限制" ${businessRule.type==0?'checked':''}>
                                        <input type="radio" name="type" value="1" title="限制每日提现次数" ${businessRule.type==1?'checked':''}>
                                        <input type="radio" name="type" value="2" title="限制每周提现次数" ${businessRule.type==2?'checked':''}>
                                        <input type="radio" name="type" value="3" title="限制每月提现次数" ${businessRule.type==3?'checked':''}>
                                    </div>
                                </div>
                                <div class="layui-card-body" style="padding: 15px;"></div>
                                <div class="layui-form-item">
                                    <div class="layui-col-sm4 layui-col-sm-offset5">
                                        <div class="layui-footer" style="left: 0;">
                                            <button class="layui-btn" type="button" onclick="saveCashSet('editBusCashSetForm')">保存</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-card-body" style="padding: 15px;"></div>
                            <input type="hidden" name="tabIndex" value="2">
                        </form>
                    </div>
                    <!-- 代理提现规则设置 -->
                    <div class="layui-tab-item" style="margin-top: 20px">
                        <form class="layui-form" id="editAgCashSetForm">
                            <input type="hidden" name="id" value="${agentCashRule.id}">
                            <div class="layui-container">
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>提现次数</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="num" value="${agentCashRule.num}" class="layui-input">
                                        <span class="green">表示用户限制提现次数(注：根据提现限制的类型 例如每天可以提现几次)</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>提现手续费</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="scale" value="${agentCashRule.scale}" class="layui-input">
                                        <span class="green">提现手续费比例,最低设置到万分比如0.0001(注：微信用户提现到零钱，微信针对平台的比例是0.006)</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>最低额</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="minVal" value="${agentCashRule.minVal}" class="layui-input">
                                        <span class="green">单笔提现最低金额</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>最高额</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="maxVal" value="${agentCashRule.maxVal}" class="layui-input">
                                        <span class="green">单笔提现最高金额(注：微信用户提现到零钱单笔是2000元)</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>提现金额的整数倍</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="text" name="multiple" value="${agentCashRule.multiple}" class="layui-input">
                                        <span class="green">提现金额的整倍数(注：微信用户提现到零钱单笔是2000元)</span>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>是否开启提现</label>
                                    <div class="layui-col-sm5" style="margin-left: 20px">
                                        <input type="radio" name="isOpen" value="1" title="开启" ${agentCashRule.isOpen==1?'checked':''}>
                                        <input type="radio" name="isOpen" value="0" title="关闭" ${agentCashRule.isOpen==0?'checked':''}>
                                    </div>
                                </div>
                                <div class="layui-form-item">
                                    <label class="layui-col-sm1 layui-col-sm-offset1"><span class="red">*&nbsp;</span>提现限制</label>
                                    <div class="layui-col-sm7" style="margin-left: 20px">
                                        <input type="radio" name="type" value="0" title="不限制" ${agentCashRule.type==0?'checked':''}>
                                        <input type="radio" name="type" value="1" title="限制每日提现次数" ${agentCashRule.type==1?'checked':''}>
                                        <input type="radio" name="type" value="2" title="限制每周提现次数" ${agentCashRule.type==2?'checked':''}>
                                        <input type="radio" name="type" value="3" title="限制每月提现次数" ${agentCashRule.type==3?'checked':''}>
                                    </div>
                                </div>
                                <div class="layui-card-body" style="padding: 15px;"></div>
                                <div class="layui-form-item">
                                    <div class="layui-col-sm4 layui-col-sm-offset5">
                                        <div class="layui-footer" style="left: 0;">
                                            <button class="layui-btn" type="button" onclick="saveCashSet('editAgCashSetForm')">保存</button>
                                        </div>
                                    </div>
                                </div>
                            </div>
                            <div class="layui-card-body" style="padding: 15px;"></div>
                            <input type="hidden" name="tabIndex" value="2">
                        </form>
                    </div>
                </div>
            </div>
        </div>
    </div>
</div>
<input type="hidden" id="tabIndex" value="${tabIndex}">
<script src="/layuiadmin/layui/layui.js"></script>
<script type="text/javascript" src="/js/jquery/jquery.min.js"></script>
<script type="text/javascript" src="/js/jquery.form.js"></script>
<script type="text/javascript" src="/js/common.js"></script>
<script type="text/javascript" src="/js/plugins/image/previewImg.js"></script>
<script type="text/javascript" src="/js/plugins/dropzone/dropzone.js"></script>
<script type="text/javascript" src="/js/plugins/layui-formSelect/formSelects-v4.min.js"></script>
<script>
    layui.config({
        //静态资源所在路径
        base: '/layuiadmin/'
    }).extend({
        //主入口模块
        index: 'lib/index'
    }).use(['index', 'form','upload'], function(){
        var $ = layui.$, admin = layui.admin, element = layui.element, layer = layui.layer;
        //tab绑定事件，页面刷新时定位到制定的tab
        //使用的是layui的'lay-id'属性
        var tabIndex = $("#tabIndex").val();
        element.tabChange('test',tabIndex);

    });

    // 保存提现规则
    function saveCashSet(form) {
        $.ajax({
            url: "/cash/editCashSetting",
            data: $('#'+form).serialize(),
            dataType: "json",
            type: "post",
            traditional: true,
            success: function (data) {
                if (data.status) {
                    layer.msg(data.desc);
                    window.setTimeout(function () {
                        window.location.reload();
                    }, 1000);
                }else{
                    layer.msg(data.desc);
                }
            }
        });
    }
</script>
</body>
</html>